#define _CRT_SECURE_NO_WARNINGS 1


#include<iostream>
using namespace std;
long long int i, e, n, m, a[200100], max1 = 0, min1 = 9999999999, c1, c2;
int main()
{
    cin >> n;
    for (i = 0;i < n;i++)
    {
        cin >> a[i];
        if (a[i] > max1)
            max1 = a[i];
        if (a[i] < min1)
            min1 = a[i];
    }
    if (min1 == max1 && min1 == 500000000)
        cout << 0 << " " << 1000000000 << endl;
    else if (1000000000 - max1 < min1)
        cout << 0 << " " << 1 << endl;
    else
        cout << 1000000000 << " " << 999999999 << endl;
    return 0;
}